package com.itboye.textileexpes.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.textileexpes.beans.AppUpdateBean;
import com.itboye.textileexpes.beans.Category_TypeTwo;
import com.itboye.textileexpes.beans.ForresterBeans;
import com.itboye.textileexpes.beans.RootBean;
import com.itboye.textileexpes.interfaces.IAppUpdate;
import com.itboye.textileexpes.interfaces.ICategory;
import com.itboye.textileexpes.interfaces.IGetYanZhengMa;
import com.itboye.textileexpes.interfaces.IMainCategory;
import com.itboye.textileexpes.interfaces.IMainCategoryTypeTwo;
import com.itboye.textileexpes.repository.APPUpdateRepository;
import com.itboye.textileexpes.repository.CategoryRepository;
import com.itboye.textileexpes.repository.MainCategoryRepository;
import com.itboye.textileexpes.repository.MainCategoryRepositoryTypeTwo;
import com.itboye.textileexpres.base.BasePresenter;
import com.itboye.textileexpres.base.ResultEntity;

public class MainCategoryTypeTwoPresenter extends BasePresenter implements
		IMainCategoryTypeTwo<Category_TypeTwo> {

	public static final String Category2_success = MainPresenter.class
			.getName() + "_category2_success";
	public static final String Category2_fail = MainPresenter.class.getName()
			+ "_category2_fail";

	
	public static final String Messge_success = MainPresenter.class
			.getName() + "_Messge_success";
	public static final String Messge_fail = MainPresenter.class.getName()
			+ "_Messge_fail";

	public MainCategoryTypeTwoPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void queryCate(int id) {
		// TODO Auto-generated method stub
		IMainCategoryTypeTwo<Category_TypeTwo> cate = new MainCategoryRepositoryTypeTwo(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Category2_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Category2_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		cate.queryCate(id);
	}

	@Override
	public void add(Category_TypeTwo model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(Category_TypeTwo model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(Category_TypeTwo model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(Category_TypeTwo model) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<Category_TypeTwo> query(Category_TypeTwo model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void onMesssge(String uid, String msg_type, String page_index,
			String page_size) {
		// TODO Auto-generated method stub
		IMainCategoryTypeTwo<Category_TypeTwo> cate = new MainCategoryRepositoryTypeTwo(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Messge_success);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Messge_fail);
						setChanged();
						notifyObservers(result);

					}
				});
		cate.onMesssge( uid,  msg_type,  page_index,page_size);
	}

}
